// bupiaodetail.js 红包详情
var shihan = require('../../../common/fetch');
var config = require('../../../common/config');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    showLoading: true,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    this.refeshbupiaodetail(options.id, options.index)
  },
  refeshbupiaodetail: function(a, index) {
    var url, title
    var that = this
    if (index == 0) {
      title = "获取详情"
      url = config.get_balance_detail
    } else if (index == 1) {
      title = "支出详情"
      url = config.get_balance_detail
    } else if (index == 2) { //提现详情
      title = "提现详情"
      url = config.get_balance_cash_info
    }
    wx.setNavigationBarTitle({
      title: title
    })
    shihan.sendRequest(url, 'POST', {
        id: a
      })
      .then(function(response) { //get_balance_detail
        that.setData({
          currentTab: index,
          bupiaodetail: response.data.data,
          showLoading: false
        })

      }, function(error) {
        console.log(error);
      });
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {

  }
})